package com.bkhc.order.entity;

import com.bkhc.common.annotation.Uid;
import com.bkhc.common.listener.DataEntityListener;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;

@Entity
@Data
@Table(name = "tbl_order_item")
@EntityListeners({AuditingEntityListener.class, DataEntityListener.class})
public class OrderItem {

    @GeneratedValue(strategy = GenerationType.AUTO)
    @Id
    private Integer id ;
    @Uid
    @Column(name = "item_code")
    private String itemCode;
    @Column(name="goods_code")
    private String goodsCode;

    @Column(name = "productName")
    private String productName;

    @Column(name = "brand_code")
    private String brandCode;

    @Column(name = "brand_name")
    private String brandName;
    @NotNull
    @Column(name = "quantity")
    private String quantity;

    @Column(name = "price")
    private String price;

    @Column(name = "total")
    private String total;

    @Column(name = "price_ver")
    private String priceVersion;

    @Column(name = "order_code")
    private String orderCode;

    @Column(name = "creator",updatable = false)
    private String creator;

    @Column(name = "create_date",updatable = false)
    @CreatedDate
    private Date createDate;

    @Column(name = "updator")
    private String updator;

    @LastModifiedDate
    @Column(name = "update_date")
    private Date updateDate;
}
